package chars;

import java.awt.Graphics;
import java.awt.Image;

public class hittable {

    public Image appearance;
    public int x;
    public int y;

    public hittable(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public void setImage(Image appearance) {
        this.appearance = appearance;
    }

    public boolean draw(Graphics g) {
        if (x < 600 && x + appearance.getWidth(null) > 0 && y < 300 && y + appearance.getHeight(null) > 0) {
            g.drawImage(appearance, x, y, null);
            return true;
        }
        return false;
    }

    public boolean checkCollision(Player player) {
        if (player.x + player.appearance.getWidth(null) > x &&
                player.x < x + appearance.getWidth(null) &&
                player.y + player.appearance.getHeight(null) > y &&
                player.y < y + appearance.getHeight(null)) {
            return true;
        }
        return false;
    }

    public void act(platformer.Manager manager) {
    }
}
